home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Workbench Add-On
/
Workbench Add-On - Volume 1.iso
/
BBS-Archive
/
Comm
/
term-source.lha
/
Extras
/
Source
/
term-Source.lha
/
PatternPanel.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-02-07
|
23KB
|
1,003 lines
/*
** PatternPanel.c
**
** Editing panel for phone number patterns
**
** Copyright © 1990-1995 by Olaf `Olsen' Barthel
** All Rights Reserved
**
** :ts=4
*/
#include "termGlobal.h"
enum { GAD_LIST,GAD_COMMENT,GAD_PATTERN,
GAD_TOP,GAD_UP,GAD_DOWN,GAD_END,
GAD_NEW,GAD_REMOVE,GAD_CLEAR,
GAD_EDIT,
GAD_LOAD,GAD_SAVE,GAD_USE
};
VOID
PatternPanel()
{
STATIC LONG ButtonID[] =
{
MSG_FASTMACROPANEL_NEW_GAD,
MSG_GLOBAL_REMOVE_GAD,
MSG_UPLOADQUEUE_CLEAR_TXT,
MSG_V36_0043
};
struct LayoutHandle *Handle;
struct PatternNode *Node;
LONG ListCount;
struct List *PhoneList;
WORD i,Max,Len;
PhoneList = CreatePhoneList();
ListCount = GetListSize(PatternList);
if(Handle = LT_CreateHandleTags(Window -> WScreen,
LH_LocaleHook, &LocaleHook,
TAG_DONE))
{
struct Window *LocalWindow;
struct IBox Bounds;
for(i = Max = 0 ; i < 4 ; i++)
{
if((Len = LT_LabelChars(Handle,LocaleString(ButtonID[i]))) > Max)
Max = Len;
}
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, VERTICAL_KIND,
LA_LabelID, MSG_AREACODE_GROUPS_TXT,
TAG_DONE);
{
LT_New(Handle,
LA_Type, LISTVIEW_KIND,
LA_LabelID, MSG_AREACODE_GROUPS_GAD,
LA_LabelPlace, PLACE_LEFT,
LA_Chars, 30,
LA_Lines, 10,
LA_ID, GAD_LIST,
LALV_CursorKey, TRUE,
LALV_ResizeX, TRUE,
LALV_ResizeY, TRUE,
LALV_MaxGrowY, 20,
LALV_MaxGrowX, 50,
GTLV_Labels, PatternList,
Kick30 ? LALV_Link : TAG_IGNORE, NIL_LINK,
TAG_DONE);
LT_New(Handle,
LA_Type, STRING_KIND,
LA_LabelID, MSG_AREACODE_NAME_GAD,
LA_ID, GAD_COMMENT,
GTST_MaxChars, 39,
GA_Disabled, TRUE,
TAG_DONE);
LT_New(Handle,
LA_Type, STRING_KIND,
LA_LabelID, MSG_AREACODE_PATTERN_GAD,
LA_ID, GAD_PATTERN,
GTST_MaxChars, 255,
GA_Disabled, TRUE,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type, HORIZONTAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, VERTICAL_KIND,
LA_LabelID, MSG_V36_0038,
TAG_DONE);
{
LT_New(Handle,
LA_Type, HORIZONTAL_KIND,
LA_SameSize, TRUE,
TAG_DONE);
{
LT_New(Handle,
LA_Type, TAPEDECK_KIND,
LATD_ButtonType, TDBT_PREVIOUS,
LATD_Smaller, TRUE,
LA_ID, GAD_TOP,
LA_NoKey, TRUE,
GA_Disabled, TRUE,
TAG_DONE);
LT_New(Handle,
LA_Type, TAPEDECK_KIND,
LATD_ButtonType, TDBT_NEXT,
LATD_Smaller, TRUE,
LA_ID, GAD_END,
LA_NoKey, TRUE,
GA_Disabled, TRUE,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type, HORIZONTAL_KIND,
LA_SameSize, TRUE,
TAG_DONE);
{
LT_New(Handle,
LA_Type, TAPEDECK_KIND,
LATD_ButtonType, TDBT_REWIND,
LATD_Smaller, TRUE,
LA_ID, GAD_UP,
LA_NoKey, TRUE,
GA_Disabled, TRUE,
TAG_DONE);
LT_New(Handle,
LA_Type, TAPEDECK_KIND,
LATD_ButtonType, TDBT_PLAY,
LATD_Smaller, TRUE,
LA_ID, GAD_DOWN,
LA_NoKey, TRUE,
GA_Disabled, TRUE,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type, VERTICAL_KIND,
LA_LabelID, MSG_V36_0043,
TAG_DONE);
{
LT_New(Handle,
LA_Type, HORIZONTAL_KIND,
LA_SameSize, TRUE,
TAG_DONE);
{
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_FASTMACROPANEL_NEW_GAD,
LA_ID, GAD_NEW,
LA_Chars, Max,
TAG_DONE);
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_GLOBAL_REMOVE_GAD,
LA_ID, GAD_REMOVE,
GA_Disabled, TRUE,
LA_Chars, Max,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type, HORIZONTAL_KIND,
LA_SameSize, TRUE,
TAG_DONE);
{
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_UPLOADQUEUE_CLEAR_TXT,
LA_ID, GAD_CLEAR,
GA_Disabled, PatternList -> lh_Head -> ln_Succ == NULL,
LA_Chars, Max,
TAG_DONE);
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_V36_0043,
LA_ID, GAD_EDIT,
GA_Disabled, TRUE,
LA_Chars, Max,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_EndGroup(Handle);
}
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,LA_Type,XBAR_KIND,LAXB_FullSize,TRUE,TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,LA_Type,HORIZONTAL_KIND,
LAGR_SameSize, TRUE,
LAGR_Spread, TRUE,
LA_ExtraSpace, TRUE,
TAG_DONE);
{
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_GLOBAL_USE_GAD,
LA_ID, GAD_USE,
LABT_ReturnKey, TRUE,
LABT_ExtraFat, TRUE,
TAG_DONE);
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_GLOBAL_LOAD_GAD,
LA_ID, GAD_LOAD,
LABT_ExtraFat, TRUE,
GA_Disabled, ChosenPattern != NULL,
TAG_DONE);
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_GLOBAL_SAVE_GAD,
LA_ID, GAD_SAVE,
LABT_ExtraFat, TRUE,
GA_Disabled, PatternList -> lh_Head -> ln_Succ == NULL,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_EndGroup(Handle);
}
if(Screen && Window)
{
Bounds . Left = Window -> LeftEdge;
Bounds . Top = Window -> TopEdge;
Bounds . Width = Window -> Width;
Bounds . Height = Window -> Height;
}
if(LocalWindow = LT_Layout(Handle,LocaleString(MSG_AREACODE_GROUPS_TITLE),Screen ? &Bounds : NULL,0,0,IDCMP_CLOSEWINDOW,0,
LAWN_HelpHook, &GuideHook,
LAWN_Parent, Window,
WA_DepthGadget, TRUE,
WA_CloseGadget, TRUE,
WA_DragBar, TRUE,
WA_RMBTrap, TRUE,
WA_Activate, TRUE,
TAG_DONE))
{
struct IntuiMessage *Message;
BOOLEAN Done = FALSE;
ULONG MsgClass,
MsgQualifier;
UWORD MsgCode;
struct Gadget *MsgGadget;
struct PatternNode *Selected = NULL;
ULONG Offset = 0;
UBYTE DummyBuffer[MAX_FILENAME_LENGTH],
*DummyChar;
struct FileRequester *FileRequest;
LONG Error;
GuideContext(CONTEXT_AREA_CODES);
PushWindow(LocalWindow);
do
{
if(Wait(PORTMASK(LocalWindow -> UserPort) | SIG_BREAK) & SIG_BREAK)
break;
while(Message = (struct IntuiMessage *)LT_GetIMsg(Handle))
{
MsgClass = Message -> Class;
MsgQualifier = Message -> Qualifier;
MsgCode = Message -> Code;
MsgGadget = (struct Gadget *)Message -> IAddress;
LT_ReplyIMsg(Message);
if(MsgClass == IDCMP_CLOSEWINDOW)
Done = TRUE;
if(MsgClass == IDCMP_IDCMPUPDATE)
{
if(MsgGadget -> GadgetID == GAD_LIST)
{
if(!Selected)
{
if(Selected = (struct PatternNode *)GetListNode(MsgCode,(struct List *)PatternList))
{
Offset = MsgCode;
LT_SetAttributes(Handle,GAD_COMMENT,
GTST_String, Selected -> Comment,
GA_Disabled, FALSE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_PATTERN,
GTST_String, Selected -> Pattern,
GA_Disabled, FALSE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_REMOVE,
GA_Disabled, &Selected -> List == ChosenPattern,
TAG_DONE);
LT_SetAttributes(Handle,GAD_EDIT,
GA_Disabled, &Selected -> List == ChosenPattern,
TAG_DONE);
LT_SetAttributes(Handle,GAD_TOP,
GA_Disabled, !Selected -> Node . ln_Pred -> ln_Pred,
TAG_DONE);
LT_SetAttributes(Handle,GAD_UP,
GA_Disabled, !Selected -> Node . ln_Pred -> ln_Pred,
TAG_DONE);
LT_SetAttributes(Handle,GAD_DOWN,
GA_Disabled, !Selected -> Node . ln_Succ -> ln_Succ,
TAG_DONE);
LT_SetAttributes(Handle,GAD_END,
GA_Disabled, !Selected -> Node . ln_Succ -> ln_Succ,
TAG_DONE);
}
}
if(Selected && (&Selected -> List != ChosenPattern))
{
LT_PressButton(Handle,GAD_EDIT);
LT_LockWindow(LocalWindow);
PatternsChanged |= RatePanel(LocalWindow,PhoneList,NULL,&Selected -> List);
LT_UnlockWindow(LocalWindow);
}
}
}
if(MsgClass == IDCMP_GADGETUP)
{
switch(MsgGadget -> GadgetID)
{
case GAD_USE:
Done = TRUE;
break;
case GAD_TOP:
LT_SetAttributes(Handle,GAD_LIST,
GTLV_Labels, ~0,
TAG_DONE);
Remove((struct Node *)Selected);
AddHead((struct List *)PatternList,(struct Node *)Selected);
Offset = 0;
LT_SetAttributes(Handle,GAD_LIST,
GTLV_Labels, PatternList,
GTLV_Selected, Offset,
GTLV_Top, Offset,
TAG_DONE);
LT_SetAttributes(Handle,GAD_TOP,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_UP,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_DOWN,
GA_Disabled, !Selected -> Node . ln_Succ -> ln_Succ,
TAG_DONE);
LT_SetAttributes(Handle,GAD_END,
GA_Disabled, !Selected -> Node . ln_Succ -> ln_Succ,
TAG_DONE);
PatternsChanged = TRUE;
break;
case GAD_UP:
LT_SetAttributes(Handle,GAD_LIST,
GTLV_Labels, ~0,
TAG_DONE);
Node = (struct PatternNode *)Selected -> Node . ln_Pred -> ln_Pred;
Remove((struct Node *)Selected);
Insert((struct List *)PatternList,(struct Node *)Selected,(struct Node *)Node);
Offset--;
LT_SetAttributes(Handle,GAD_LIST,
GTLV_Labels, PatternList,
GTLV_Selected, Offset,
GTLV_Top, Offset,
TAG_DONE);
LT_SetAttributes(Handle,GAD_TOP,
GA_Disabled, !Selected -> Node . ln_Pred -> ln_Pred,
TAG_DONE);
LT_SetAttributes(Handle,GAD_UP,
GA_Disabled, !Selected -> Node . ln_Pred -> ln_Pred,
TAG_DONE);
LT_SetAttributes(Handle,GAD_DOWN,
GA_Disabled, !Selected -> Node . ln_Succ -> ln_Succ,
TAG_DONE);
LT_SetAttributes(Handle,GAD_END,
GA_Disabled, !Selected -> Node . ln_Succ -> ln_Succ,
TAG_DONE);
PatternsChanged = TRUE;
break;
case GAD_DOWN:
LT_SetAttributes(Handle,GAD_LIST,
GTLV_Labels, ~0,
TAG_DONE);
Node = (struct PatternNode *)Selected -> Node . ln_Succ;
Remove((struct Node *)Selected);
Insert((struct List *)PatternList,(struct Node *)Selected,(struct Node *)Node);
Offset++;
LT_SetAttributes(Handle,GAD_LIST,
GTLV_Labels, PatternList,
GTLV_Selected, Offset,
GTLV_Top, Offset,
TAG_DONE);
LT_SetAttributes(Handle,GAD_TOP,
GA_Disabled, !Selected -> Node . ln_Pred -> ln_Pred,
TAG_DONE);
LT_SetAttributes(Handle,GAD_UP,
GA_Disabled, !Selected -> Node . ln_Pred -> ln_Pred,
TAG_DONE);
LT_SetAttributes(Handle,GAD_DOWN,
GA_Disabled, !Selected -> Node . ln_Succ -> ln_Succ,
TAG_DONE);
LT_SetAttributes(Handle,GAD_END,
GA_Disabled, !Selected -> Node . ln_Succ -> ln_Succ,
TAG_DONE);
PatternsChanged = TRUE;
break;
case GAD_END:
LT_SetAttributes(Handle,GAD_LIST,
GTLV_Labels, ~0,
TAG_DONE);
Remove((struct Node *)Selected);
AddTail((struct List *)PatternList,(struct Node *)Selected);
Offset = ListCount - 1;
LT_SetAttributes(Handle,GAD_LIST,
GTLV_Labels, PatternList,
GTLV_Selected, Offset,
GTLV_Top, Offset,
TAG_DONE);
LT_SetAttributes(Handle,GAD_TOP,
GA_Disabled, !Selected -> Node . ln_Pred -> ln_Pred,
TAG_DONE);
LT_SetAttributes(Handle,GAD_UP,
GA_Disabled, !Selected -> Node . ln_Pred -> ln_Pred,
TAG_DONE);
LT_SetAttributes(Handle,GAD_DOWN,
GA_Disabled, !Selected -> Node . ln_Succ -> ln_Succ,
TAG_DONE);
LT_SetAttributes(Handle,GAD_END,
GA_Disabled, !Selected -> Node . ln_Succ -> ln_Succ,
TAG_DONE);
PatternsChanged = TRUE;
break;
case GAD_NEW:
if(Node = CreatePatternNode(""))
{
LT_SetAttributes(Handle,GAD_LIST,
GTLV_Labels, ~0,
TAG_DONE);
AddTail((struct List *)PatternList,(struct Node *)Node);
LT_SetAttributes(Handle,GAD_LIST,
GTLV_Labels, PatternList,
GTLV_Selected, ListCount++,
TAG_DONE);
LT_SetAttributes(Handle,GAD_PATTERN,
GTST_String, "",
GA_Disabled, FALSE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_COMMENT,
GTST_String, "",
GA_Disabled, FALSE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_REMOVE,
GA_Disabled, &Selected -> List == ChosenPattern,
TAG_DONE);
LT_SetAttributes(Handle,GAD_EDIT,
GA_Disabled, &Selected -> List == ChosenPattern,
TAG_DONE);
LT_SetAttributes(Handle,GAD_SAVE,
GA_Disabled, FALSE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_CLEAR,
GA_Disabled, FALSE,
TAG_DONE);
Selected = Node;
Offset = ListCount - 1;
LT_SetAttributes(Handle,GAD_TOP,
GA_Disabled, !Selected -> Node . ln_Pred -> ln_Pred,
TAG_DONE);
LT_SetAttributes(Handle,GAD_UP,
GA_Disabled, !Selected -> Node . ln_Pred -> ln_Pred,
TAG_DONE);
LT_SetAttributes(Handle,GAD_DOWN,
GA_Disabled, !Selected -> Node . ln_Succ -> ln_Succ,
TAG_DONE);
LT_SetAttributes(Handle,GAD_END,
GA_Disabled, !Selected -> Node . ln_Succ -> ln_Succ,
TAG_DONE);
LT_Activate(Handle,GAD_COMMENT);
PatternsChanged = TRUE;
}
else
DisplayBeep(LocalWindow -> WScreen);
break;
case GAD_CLEAR:
LT_SetAttributes(Handle,GAD_LIST,
GTLV_Labels, ~0,
TAG_DONE);
FreeList((struct List *)PatternList);
ListCount = 0;
LT_SetAttributes(Handle,GAD_LIST,
GTLV_Labels, PatternList,
GTLV_Selected, ~0,
TAG_DONE);
Selected = NULL;
LT_SetAttributes(Handle,GAD_TOP,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_UP,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_DOWN,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_END,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_REMOVE,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_EDIT,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_COMMENT,
GTST_String, "",
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_PATTERN,
GTST_String, "",
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_SAVE,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_CLEAR,
GA_Disabled, TRUE,
TAG_DONE);
PatternsChanged = FALSE;
break;
case GAD_EDIT:
if(Selected)
{
LT_LockWindow(LocalWindow);
PatternsChanged |= RatePanel(LocalWindow,PhoneList,NULL,&Selected -> List);
LT_UnlockWindow(LocalWindow);
}
break;
case GAD_REMOVE:
if(Selected)
{
LT_SetAttributes(Handle,GAD_LIST,
GTLV_Labels, ~0,
TAG_DONE);
if(--ListCount)
{
if(Selected -> Node . ln_Succ -> ln_Succ)
Node = (struct PatternNode *)Selected -> Node . ln_Succ;
else
{
Node = (struct PatternNode *)Selected -> Node . ln_Pred;
Offset = 0;
}
}
Remove((struct Node *)Selected);
DeletePatternNode(Selected);
LT_SetAttributes(Handle,GAD_LIST,
GTLV_Labels, PatternList,
GTLV_Selected, Node -> Node . ln_Succ ? GetNodeOffset((struct Node *)Node,(struct List *)PatternList) : ~0,
TAG_DONE);
if(!ListCount)
{
Selected = NULL;
LT_SetAttributes(Handle,GAD_TOP,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_UP,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_DOWN,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_END,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_REMOVE,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_EDIT,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_COMMENT,
GTST_String, "",
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_PATTERN,
GTST_String, "",
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_SAVE,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_CLEAR,
GA_Disabled, TRUE,
TAG_DONE);
}
else
{
Selected = Node;
LT_SetAttributes(Handle,GAD_PATTERN,
GTST_String, Selected -> Pattern,
TAG_DONE);
LT_SetAttributes(Handle,GAD_COMMENT,
GTST_String, Selected -> Comment,
TAG_DONE);
LT_SetAttributes(Handle,GAD_TOP,
GA_Disabled, !Selected -> Node . ln_Pred -> ln_Pred,
TAG_DONE);
LT_SetAttributes(Handle,GAD_UP,
GA_Disabled, !Selected -> Node . ln_Pred -> ln_Pred,
TAG_DONE);
LT_SetAttributes(Handle,GAD_DOWN,
GA_Disabled, !Selected -> Node . ln_Succ -> ln_Succ,
TAG_DONE);
LT_SetAttributes(Handle,GAD_END,
GA_Disabled, !Selected -> Node . ln_Succ -> ln_Succ,
TAG_DONE);
}
PatternsChanged = TRUE;
}
break;
case GAD_LIST:
if(Selected = (struct PatternNode *)GetListNode(MsgCode,(struct List *)PatternList))
{
Offset = MsgCode;
LT_SetAttributes(Handle,GAD_COMMENT,
GTST_String, Selected -> Comment,
GA_Disabled, FALSE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_PATTERN,
GTST_String, Selected -> Pattern,
GA_Disabled, FALSE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_REMOVE,
GA_Disabled, &Selected -> List == ChosenPattern,
TAG_DONE);
LT_SetAttributes(Handle,GAD_EDIT,
GA_Disabled, &Selected -> List == ChosenPattern,
TAG_DONE);
LT_SetAttributes(Handle,GAD_TOP,
GA_Disabled, !Selected -> Node . ln_Pred -> ln_Pred,
TAG_DONE);
LT_SetAttributes(Handle,GAD_UP,
GA_Disabled, !Selected -> Node . ln_Pred -> ln_Pred,
TAG_DONE);
LT_SetAttributes(Handle,GAD_DOWN,
GA_Disabled, !Selected -> Node . ln_Succ -> ln_Succ,
TAG_DONE);
LT_SetAttributes(Handle,GAD_END,
GA_Disabled, !Selected -> Node . ln_Succ -> ln_Succ,
TAG_DONE);
}
break;
case GAD_COMMENT:
if(Selected)
{
LT_SetAttributes(Handle,GAD_LIST,
GTLV_Labels, ~0,
TAG_DONE);
strcpy(Selected -> Comment,LT_GetString(Handle,GAD_COMMENT));
LT_SetAttributes(Handle,GAD_LIST,
GTLV_Labels, PatternList,
GTLV_Selected, GetNodeOffset((struct Node *)Selected,(struct List *)PatternList),
TAG_DONE);
LT_SetAttributes(Handle,GAD_PATTERN,
GTST_String, Selected -> Pattern,
TAG_DONE);
LT_SetAttributes(Handle,GAD_COMMENT,
GTST_String, Selected -> Comment,
TAG_DONE);
PatternsChanged = TRUE;
LT_Activate(Handle,GAD_PATTERN);
}
break;
case GAD_PATTERN:
if(Selected)
{
strcpy(Selected -> Pattern,LT_GetString(Handle,GAD_PATTERN));
PatternsChanged = TRUE;
}
break;
case GAD_LOAD:
SplitFileName(LastPattern,&DummyChar,DummyBuffer);
LT_LockWindow(LocalWindow);
if(FileRequest = GetFile(LocalWindow,LocaleString(MSG_AREACODE_LOAD_GROUP_SETTINGS_TXT),DummyBuffer,FilePart(LastPattern),DummyBuffer,"#?.prefs",FALSE,FALSE,FALSE,LocaleString(MSG_GLOBAL_LOAD_TXT),TRUE))
{
struct List *SomeList;
LT_SetAttributes(Handle,GAD_LIST,
GTLV_Labels, ~0,
TAG_DONE);
Selected = NULL;
if(!(SomeList = LoadTimeDateList(DummyBuffer,&Error)))
ShowError(LocalWindow,ERR_LOAD_ERROR,Error,DummyBuffer);
else
{
DeletePatternList(PatternList);
PatternList = SomeList;
strcpy(LastPattern,DummyBuffer);
PatternsChanged = FALSE;
}
LT_SetAttributes(Handle,GAD_LIST,
GTLV_Labels, PatternList,
TAG_DONE);
LT_SetAttributes(Handle,GAD_PATTERN,
GTST_String, "",
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_COMMENT,
GTST_String, "",
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_REMOVE,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_EDIT,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_TOP,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_UP,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_DOWN,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_END,
GA_Disabled, TRUE,
TAG_DONE);
LT_SetAttributes(Handle,GAD_SAVE,
GA_Disabled, !ListCount,
TAG_DONE);
LT_SetAttributes(Handle,GAD_CLEAR,
GA_Disabled, !ListCount,
TAG_DONE);
FreeAslRequest(FileRequest);
}
LT_UnlockWindow(LocalWindow);
break;
case GAD_SAVE:
SplitFileName(LastPattern,&DummyChar,DummyBuffer);
LT_LockWindow(LocalWindow);
if(FileRequest = GetFile(LocalWindow,LocaleString(MSG_AREACODE_SAVE_GROUP_SETTINGS_TXT),DummyBuffer,FilePart(LastPattern),DummyBuffer,"#?.prefs",TRUE,FALSE,FALSE,LocaleString(MSG_GLOBAL_SAVE_TXT),TRUE))
{
if(!SaveTimeDateList(DummyBuffer,PatternList,&Error))
ShowError(LocalWindow,ERR_SAVE_ERROR,Error,DummyBuffer);
else
{
strcpy(LastPattern,DummyBuffer);
PatternsChanged = FALSE;
}
FreeAslRequest(FileRequest);
}
LT_UnlockWindow(LocalWindow);
break;
}
}
}
}
while(!Done);
PopWindow();
}
LT_DeleteHandle(Handle);
}
if(PhoneList)
DeletePhoneList(PhoneList);
}